﻿Imports System.Xml
Imports System.Xml.Serialization

Namespace Maps.Draw.Kml
    Public Enum BoolType
        <XmlEnum("0")> [False] = 0
        <XmlEnum("1")> [True] = 1
    End Enum

    Public Enum ColorModeType
        normal
        random
    End Enum

    Public MustInherit Class ObjectBase

        <XmlAttributeAttribute()> _
        Public id As String

        <XmlAttributeAttribute()> _
        Public targetId As String

    End Class

    <XmlIncludeAttribute(GetType(Placemark))> _
    Public MustInherit Class FeatureBase
        Inherits ObjectBase

        Public name As String

        Public description As String

        Public styleUrl As String

        <XmlElementAttribute("Style")> _
        Public StyleSelector As New List(Of Style)
        'Public visibility As BoolType = BoolType.False
        'Public open As BoolType = BoolType.False


    End Class

    <XmlIncludeAttribute(GetType(Document))> _
    Public MustInherit Class ContainerBase
        Inherits FeatureBase

        <XmlElementAttribute("Document", GetType(Document)), _
        XmlElementAttribute("Placemark", GetType(Placemark))> _
        Public Feature As New List(Of FeatureBase)

    End Class

    <XmlIncludeAttribute(GetType(Polygon)), _
    XmlIncludeAttribute(GetType(LinearRing))> _
    Public MustInherit Class GeometryBase

        Public id As String

    End Class

    <XmlIncludeAttribute(GetType(PolyStyle)), _
    XmlIncludeAttribute(GetType(LineStyle))> _
    Public MustInherit Class ColorStyleBase
        Inherits ObjectBase

        Public color As String = "FFFFFFFF"

        Public colorMode As ColorModeType = ColorModeType.normal

    End Class

    Public MustInherit Class StyleSelector
        Inherits ObjectBase

    End Class

    '----------------------------------------------------------------------------------------------------------

    Public Class kml
        Inherits ContainerBase

    End Class
    Public Class Document
        Inherits ContainerBase

    End Class
    Public Class Placemark
        Inherits FeatureBase

        <XmlElementAttribute("Polygon", GetType(Polygon))> _
        <XmlElementAttribute("LinearRing", GetType(LinearRing))> _
        Public Geometry As GeometryBase

    End Class

    Public Class Polygon
        Inherits GeometryBase

        Public outerBoundaryIs As Boundary

        <XmlElementAttribute("innerBoundaryIs")> _
        Public innerBoundaryIs As New List(Of Boundary)

    End Class
    Public Class Boundary
        Public LinearRing As LinearRing
    End Class

    Public Class LinearRing
        Inherits GeometryBase

        Public coordinates As String
    End Class

    Public Class PolyStyle
        Inherits ColorStyleBase

        Public fill As BoolType = BoolType.True

        Public outline As BoolType = BoolType.True

    End Class

    Public Class LineStyle
        Inherits ColorStyleBase

        Public width As Integer = 1

    End Class

    Public Class Style
        Inherits StyleSelector

        '<XmlElementAttribute("PolyStyle", GetType(PolyStyle))> _
        'Public ColorStyle() As ColorStyleBase

        <XmlElementAttribute("PolyStyle", GetType(PolyStyle)), _
        XmlElementAttribute("LineStyle", GetType(LineStyle))> _
        Public ColorStyle As New List(Of ColorStyleBase)


    End Class

End Namespace
